/**
 * 
 */
package org.Ogre.OgreMain;

/**
 * This is a abstract class that provides the interface for the query class for
 * hardware occlusion.
 * 
 * @author Wilson
 *
 */
public abstract class HardwareOcclusionQuery {
	
	/**
	 * Default object constructor
	 */
	HardwareOcclusionQuery(){}
	
	/**
	 * Starts the hardware occlusion query
	 * @remarks Simple usage: Create one or more occlusionQuery object one per 
	 * outstanding query or one per tested object
	 * OcclusionQuery* m_pOcclusionQuery;
	 * createOcclusionQuery( &m_pOcclusionQuery );
	 * In the rendering loop:
	 * Draw all occluders
	 * m_pOcclusionQuery->startOcclusionQuery();
	 * Draw the polygons to be tested
	 * m_pOcclusionQuery->endOcclusionQuery();
	 * 
	 * Results must be pulled using:
	 * UINT m_uintNumberOfPixelsVisable;
	 * pullOcclusionQuery( &m_dwNumberOfPixelsVisable );
	 */
	public abstract void beginOcclusionQuery();
	
	/**
	 * Ends the hardware occlusion test
	 */
	public abstract void endOcclusionQuery();
	
	/**
	 * Pulls the hardware occlusion query.
	 * @note Waits until the query result is available; use isStillOutstanding
	 * if just want to test if the result is available;
	 * @retval NumOfFragments will get the resulting number of fragments.
	 * @return True if success or false if not.
	 */
	public abstract boolean pullOcclusionQuery( Long NumOfFragments );
	
	/**
	 * Let's you get the last pixel count with out doing the hardware occlusion test
	 * @remarks This function won't give you new values, just the old value.
	 * @return The last fragment count from the last test.
	 */
	public long getLastQuerysPixelcount() 
	{
		return m_PixelCount; 
	}
	
	/**
	 * Let's you know when query is done, or still be processed by the Hardware
	 * @return true if query isn't finished.
	 */
	public abstract boolean isStillOutstanding();
	
	// numbers of visible pixels determined by last query
	protected long m_PixelCount;
	// is query hasn't yet returned a result
	protected boolean m_IsQueryResultStillOutstanding;
}
